package com.sxj.corejava.code07_面向对象.封装;

/**
 * @author 石小俊
 * @date 2024年03月16日 10:24
 */
public class Employee {
    private String name;
    private double salary;
    private String gender;
    private int age;

    public Employee(String gender) {
        this.gender = gender;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    // 性别只读,只能看不能改,因此不提供set方法
//    public void setGender(String gender){
//        this.gender = gender;
//    }
    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public double getSalary() {
        return salary;
    }

    public String getGender() {
        return gender;
    }

    public int getAge() {
        if (age < 18) {
            age = 18;
        }
        return age;
    }

    public void show() {
        System.out.println("姓名:" + name + ",工资:" + salary + ",性别:" + gender + ",年龄:" + age);
    }

    public void work() {
        System.out.println(name + "正在苦逼的进行了996,每个月收入" + salary + "元");
    }
}
